local skel = fk.CreateSkill {
  name = "emo__zhenwoyz",
  tags = {Skill.Wake},
}

Fk:loadTranslationTable{
  ["emo__zhenwoyz"] = "此身已知真我",
  [":emo__zhenwoyz"] = "觉醒技，当你转化过所有基本牌后，〖自堕轮回阿鼻〗删除“转换技”、“对应”与最后一句。",
  ["@$emo__zhenwoyz"] = "知真我",
}

skel:addEffect(fk.CardUsing, {
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and data.card.type == Card.TypeBasic and data.card:isVirtual()
  end,
  can_wake = function (self, event, target, player, data)
    return #player:getTableMark("@$emo__zhenwoyz") >= #Fk:getAllCardNames("b")
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    if not table.contains(player:getSkillNameList(), "emo__ziduolh") then return end
    room:setPlayerMark(player, "@$emo__zhenwoyz", 0)
    local skill = player:getSwitchSkillState("emo__ziduolh") == fk.SwitchYang and "emo__ziduoyang" or "emo__ziduoyin"
    room:handleAddLoseSkills(player, "-emo__ziduolh|"..skill, nil, false, true)
  end,
})

skel:addEffect(fk.CardUsing, {
  can_refresh = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name, true) and data.card.type == Card.TypeBasic and data.card:isVirtual()
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:addTableMarkIfNeed(player, "@$emo__zhenwoyz", data.card.name)
  end,
})

skel:addLoseEffect(function (self, player, is_death)
  player.room:setPlayerMark(player, "@$emo__zhenwoyz", 0)
end)

return skel
